package com.leetcode.LC;

import java.util.HashSet;

public class LC1684 {
    public int countConsistentStrings(String allowed, String[] words) {

        int count = 0;
        HashSet<Character> set = new HashSet<>();
        for (int i = 0; i < allowed.length(); i++) {
            set.add(allowed.charAt(i));
        }
        for (String word : words) {
            boolean f = false;
            for (int i = 0; i < word.length(); i++) {
                if (!set.contains(word.charAt(i))) {
                    f = true;
                    break;
                }
            }
            if (!f) {
                count++;
            }
        }
        return count;

    }
}
